let form = document.querySelector('form.needs-validation')
    form && form.addEventListener('submit', function(event) {
        event.preventDefault();
        event.stopPropagation();
        if (form.checkValidity() === false) {
            form.classList.add('was-validated');
            return
        }
        if (form.password1 != null) {
            if (form.password.value !== form.password1.value) {
                form.password1.classList.add('is-invalid')
                return
            } else {
                form.password1.classList.remove('is-invalid')
            }
        }
        url = form.acion
        axios.post(url, {
            name: form.name.value,
            email: form.email.value,
            password: sha1(form.email.value+ ':' + form.password.value).toString(),
        })
        .then(function (response) {
            // console.log(response);
            if (response.status === 200) {
                let data = response.data
                if (data['code'] === 0) {
                    console.log(data['msg'])
                } else {
                    console.log(data['msg'])
                }
            }
        })
        .catch(function (error) {
            console.log(error);
        });
    }, false);